﻿<cfsilent>
	<cfscript>
		
		dictAdvice = getProperty("serviceFactory").getBean("senateDictionaryAdvice");
		propertyAdvice = getProperty("serviceFactory").getBean("studentPropertyAdvice");
		markAdvice = getProperty("serviceFactory").getBean("markAdvice");
		propertyAdvice = getProperty("serviceFactory").getBean("studentPropertyAdvice");
		
		classId = event.getArg('Class');
		
		/* 读取班级 专业信息 */
		sql = "SELECT 
				a.cls_name, a.grade, b.sbj_id, b.sbj_short 
				FROM t_class a 
				INNER JOIN t_subject b ON a.sbj_id = b.sbj_id 
				WHERE a.cls_id = :classId ";
		
		queryObj = new Query( datasource=application.dnsSlave );
		queryObj.addParam( name="classId", value=classId, cfsqltype = "cf_sql_char");

		rs_class = queryObj.execute( sql=sql ).getResult();

		
		/* 读取班级学生分数统计 */
		sql = "SELECT 
				a.stu_id, a.stu_name, a.stu_sex, 
				b.credit, b.credit_req, b.credit_opt, b.credit_phy, b.credit_com, b.credit_failure, 
				b.credit_req_avgpt, b.credit_avgpt, 
				c.student_prop 
				FROM t_student a 
				INNER JOIN t_student_profile b ON a.stu_id = b.stu_id 
				INNER JOIN t_student_status c ON c.stu_id = a.stu_id 
				WHERE 
					EXISTS(
						SELECT 1 FROM i_stu_class_info d where d.stu_id = a.stu_id and d.cls_id = :classId 
					) ";
		
		queryObj = new Query( datasource=application.dnsSlave );
		queryObj.addParam( name="classId", value=classId, cfsqltype = "cf_sql_char");
		
		rs_student = queryObj.execute( sql=sql ).getResult();

		
		event.setArg("pageTitle", "教学运行基础数据 - 学生学籍 - 班级学生成绩分析 - " & rs_class.cls_name);
		
		passArgs = structNew();
		structInsert(passArgs, "CLS", classId );
		structInsert(passArgs, "SubID", rs_class.sbj_id );
		structInsert(passArgs, "TabID", "labGrade" & rs_class.grade );
		
		currentTab = event.getArg("TabID", "labClass");
		
		/* 计算在校学生人数 */
		inSchool = 0;
		
		for ( a=1; a LTE rs_student.recordCount; a++ ) {
			
			propertyAdvice.parseProperty( rs_student["student_prop"][a] );
			
			if ( propertyAdvice.getInSchool() ) inSchool++;
		}
		
	</cfscript>
</cfsilent>

<div id="headArea">
	<div class="uiHeader uiHeaderWithImage ptm">
		<div class="clearfix uiHeaderTop">
			<div class="uiHeaderActions rfloat">
				<a class="uiButton" href="<cfoutput>#buildURL('studentMarkBySubject', passArgs)#</cfoutput>"><i class="mrs img btnList"></i><span class="uiButtonText"><cfoutput>#rs_class.sbj_short#</cfoutput> <cfoutput>#rs_class.grade#</cfoutput>级</span></a>
			</div>
			<div>
				<h2 class="uiHeaderTitle">
					<i class="uiHeaderImage img icon16x16 application"></i><cfoutput>#rs_class.cls_name#</cfoutput> 学生学习进度分布
				</h2>
			</div>
		</div>
	</div>
</div>

<div class="UIElement">
	<ul class="senateFirstPage">
		<li>
			<div class="clearfix" id="summary">
				<div class="UItab">
					<div class="tabLables">
						<span <cfif currentTab eq "labClass">class="active"</cfif> id="labClass" tabTarget="Class">班级学习进度</span>
					</div>
				</div>
				<script language="javascript" type="text/javascript">
					//<![CDATA[
					<!--
					$(document).ready(function() {
						
						/* init Tab */
						$("div.tabContent").hide();
						$("div#" + $("div.tabLables span.active").attr("tabTarget")).show();
						
						$("div.tabLables > span").click(function(){
							var $targetID = $(this).attr("tabTarget");
							
							$("div.tabLables span").removeClass("active");
							$(this).addClass("active");
							
							$("div.tabContent").not('[id="' + $targetID + '"]').hide();
							$("div.tabContent#" + $targetID).show();
						});
						
					});
					// -->
					//]]>
				</script>
				
				<div id="Class" class="tabContent">
					
					<div class="noticeBlock">
						<div class="operation">
							<a class="uiButton" target="_blank" href="<cfoutput>#buildURL('classMarkPassPrint', passArgs)#</cfoutput>"><i class="mrs img btnPrint"></i><span class="uiButtonText">打印班级通过课程成绩单</span></a>
							<a class="uiButton" target="_blank" href="<cfoutput>#buildURL('classMarkPrint', passArgs)#</cfoutput>"><i class="mrs img btnPrint"></i><span class="uiButtonText">打印班级成绩单</span></a>
							<a class="uiButton uiButtonSpecial" href="<cfoutput>#buildURL('studentMarkByClassDownloadExcel', passArgs)#</cfoutput>"><i class="mrs img btnDownload"></i><span class="uiButtonText">下载班级学分统计</span></a>
						</div>
						<h3><cfoutput>#rs_class.cls_name#</cfoutput></h3>
						<p><span class="img icon16x16 message"></span>该行政班在籍学生 <em><cfoutput>#rs_student.recordCount#</cfoutput></em> 名, 目前在校学生 <em><cfoutput>#inSchool#</cfoutput></em> 名. </p>
						<hr/>
					</div>
					
					<cfset row = 0 />
					<table class="UIEditable">
						<thead>
							<tr>
								<td width="18"></td>
								<td width="90">学号</td>
								<td>姓名</td>
								<td width="35">性别</td>
								<td width="50">总学分</td>
								<td width="45">必修</td>
								<td width="45">限选</td>
								<td width="45">任选</td>
								<td width="45">体育</td>
								<td width="50">不及格</td>
								<td width="60">必修课绩点</td>
								<td width="60">课程绩点</td>
								<td width="18"></td>
							</tr>
						</thead>
						<tbody>
							<cfloop query="rs_student">
									
								<cfset row++ />
								<cfset structInsert(passArgs, "STU", rs_student.stu_id, true) />
								<cfset structDelete(passArgs, "TabID", false) />
								<cfset propertyAdvice.parseProperty( rs_student.student_prop ) />
								
								<tr class="editRows <cfif not propertyAdvice.getInSchool()>cancelRow</cfif>">
									<td class="index"><cfoutput>#row#</cfoutput></td>
									<td><span class="numeric"><cfoutput>#rs_student.stu_id#</cfoutput></span></td>
									<td><cfoutput>#rs_student.stu_name#</cfoutput></td>
									<td><cfif rs_student.stu_sex eq "1">男<cfelse>女</cfif></td>
									<td><cfif rs_student.credit gt 0><span class="numeric"><cfoutput>#numberFormat( rs_student.credit, "_.__" )#</cfoutput></span></cfif></td>
									<td><cfif rs_student.credit_req gt 0><span class="numeric"><cfoutput>#numberFormat( rs_student.credit_req, "_.__" )#</cfoutput></span></cfif></td>
									<td><cfif rs_student.credit_opt gt 0><span class="numeric"><cfoutput>#numberFormat( rs_student.credit_opt, "_.__" )#</cfoutput></span></cfif></td>
									<td><cfif rs_student.credit_com gt 0><span class="numeric"><cfoutput>#numberFormat( rs_student.credit_com, "_.__" )#</cfoutput></span></cfif></td>
									<td><cfif rs_student.credit_phy gt 0><span class="numeric"><cfoutput>#numberFormat( rs_student.credit_phy, "_.__" )#</cfoutput></span></cfif></td>
									<td><cfif rs_student.credit_failure gt 0><span class="numeric alertCell"><cfoutput>#numberFormat( rs_student.credit_failure, "_.__" )#</cfoutput></span></cfif></td>
									<td><cfif rs_student.credit_req_avgpt gt 0><span class="numeric bold"><cfoutput>#numberFormat( rs_student.credit_req_avgpt, "_.__" )#</cfoutput></span></cfif></td>
									<td><cfif rs_student.credit_avgpt gt 0><span class="numeric bold"><cfoutput>#numberFormat( rs_student.credit_avgpt, "_.__" )#</cfoutput></span></cfif></td>
									<td><a href="<cfoutput>#buildURL('studentMarkView', passArgs)#</cfoutput>" class="stat details"></a></td>
								</tr>
								
							</cfloop>
						</tbody>
					</table>
					
				</div>
			
			</div>
		</li>
	</ul>
</div>